package com.spring.condition;

import com.spring.bean.Red;
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * Description:
 *
 * @author lijie
 * @create 2019-01-15 23:23
 * Update by lijie 2019-01-15 23:23
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        BeanDefinition beanDefinition=new AnnotatedGenericBeanDefinition(Red.class);
        registry.registerBeanDefinition("red",beanDefinition);
    }
}
